With increasing performance of personal computers, there has arisen a need to handle moving images such as TV signals on personal computers. When handling moving images on a personal computer, an apparatus such as a digital VTR for inputting moving images to the personal computer is connected, and moving image data prerecorded on a video tape or the like is input to the personal computer via the apparatus. The input moving image data is processed in various ways such as display on the screen of the personal computer and recording on a hard disk.
On the other hand, when playing back moving image data with audio on a personal computer, sample data conversion for converting the frequency of video and audio of digital format may become necessary because of the constraints of the hardware constituting the personal computer and other software.
In the prior art, when performing sample rate conversion, it is common practice to first upsample the input digital data and then apply low-pass filtering to decimate the data according to the output sample rate.
A sample data conversion method according to the prior art will be described below with reference to FIG. 17.
FIG. 17 is a diagram for explaining one example of sample data conversion according to the prior art.
The example of FIG. 17 shows sample data sequence conversion in the case where an input sample data sequence X[i] consisting of 400 samples is converted into an output sample data sequence Y[j] consisting of 300 samples. In this example, data X[i] represents, for example, the actual pixel value of the input image before the conversion, while Y[j] represents the pixel value of the output image after the conversion. In this case, i and j are variables each corresponding to the position coordinates of a pixel in the horizontal direction on a line in a frame.
First, a data sequence Z[k] upsampled from the input sample data sequence X[i] is obtained. When performing the upsampling, interpolation must be applied to the input sample data sequence X[i] so that all sample values Y[j] in the output sample data sequence Y[j] after the conversion will be contained in the data sequence Z[k]. Accordingly, the number of samples in the upsampled data sequence Z [k] is the least common multiple of the number of samples in the input sample data sequence X[i] and the number of samples in the output sample data sequence Y[j]. That is, it is the least common multiple of the number of samples before the conversion and the number of samples after the conversion. In the illustrated example, the number of samples in the upsampled data sequence Z[k] is 1,200 which is the least common multiple of 400 and 300.
Then, after low-pass filtering the upsampled data sequence Z[k] to eliminate distortion due to aliasing, unnecessary samples are decimated to obtain the output sample data sequence Y[j]. In the example of FIG. 17, the output sample data sequence Y[j] can be obtained by selecting, for example, a first sample in the upsampled data sequence Z[k], and then selecting every fourth sample from the first sample.
The above-described method is disclosed, for example, in Japanese Laid-open Patent No. 10-164468.
In the above method, when obtaining each sample in the upsampled data sequence Z[k], there frequently occur calculations for obtaining the value of a sample between two adjacent samples X[i] and X[i+1] in the input sample data sequence X[i] by weighted averaging based on the ratio between the distance from X[i] and the distance from X[i+1], i.e., (1−w):w (0≦w≦1). When obtaining a number AX existing at a designated position between two numbers A1 and A2 by using the ratio of the distances from A1 and A2 as described above, if the following (equation 12) holds, the value of the number AX is expressed by (equation 13) shown below.(Distance between numbers A1 and AX):(Distance between numbers AX and A2)=(1−w):w  (Equation 12)
where 0≦w≦1AX=w×A1+(1−w)×A2  (Equation 13)
When obtaining a number AX lying between two adjacent numbers A1 and A2 by a computer as described above, the method based on the flow chart of FIG. 18 is usually employed.
In FIG. 18, 1801 is a first load step, 1802 is a second load step, 1803 is a third load step, 1804 is a fourth load step, 1805 is a first multiplication step, 1806 is a subtraction step, 1807 is a second multiplication step, 1808 is an addition step, and 1809 is an output step.
The operation of the flow chart of FIG. 18 will be described below.
The two input sample values A1 and A2 and parameter w are loaded into a register A, a register B, and a register C in the first load step 1801, the second load step 1802, and the third load step 1803, respectively, and a numeric value 1 is loaded into a register D in the fourth load step 1804.
Next, in the first multiplication step 1805, the contents of the register A is multiplied by the contents of the register C. After the multiplication, (w×A1) is held in the register A.
In the subtraction step 1806, the contents of the register C is subtracted from the contents of the register D. After the subtraction, (1−w) is held in the register D.
In the second multiplication step 1807, the contents of the register B is multiplied by the contents of the register D. After the multiplication, (1−w)×A2 is held in the register B.
In the addition step 1808, the contents of the register B is added to the contents of the register A. After the addition, (w×A1+(1−w)×A2) is held in the register A.
Finally, in the output step 1809, AX, that is, (w×A1+(1−w)×A2), is output.
In this example, the operations necessary to obtain one number AX are four load operations, two multiplication operations, a subtraction, and an addition.
With recent advances in computer technology, it has become possible to accomplish the above-described sample data conversion at relatively high speed not only by dedicated hardware but also by personal computers (PCs).
However, in the above prior art which is directed to the processing of moving image data that does not have a real time requirement, the following problem occurs (1) if the PC does not have sufficient performance for handling moving images or, (2) even if the PC has sufficient performance as mentioned above, when interrupt processing occurs during moving image processing, though in the latter case there will be no problem when the PC processes only moving image data.
That is, since the amount of moving image data is very large, there can occur cases where the processing of the input moving image data for playback or for recording on a recording medium such as a hard disk cannot be completed in time, and in such cases, processing of part of the data has had to be given up. This has lead to the problem that when recording moving images on a hard disk, part of a scene is dropped or the recording of image data itself is stopped.
Furthermore, in the sample number conversion of the above-mentioned prior art, when performing the upsampling, data must be interpolated so that all samples after the conversion will be contained.
As a result, the number of samples in the upsampled data sequence is the least common multiple of the number of samples before the conversion and the number of samples after the conversion.
However, even when the number of samples before the conversion, M, and the number of samples after the conversion, N, are both small, if M and N are natural numbers relatively prime to each other, the number of samples in the upsampled data sequence is M×N, which can become a large number depending on the case. In that case, a memory having a very large capacity is needed in order to hold the upsampled data sequence.
Furthermore, in that case, the upsampling requires an enormous number of multiplications and subtractions, which means that an enormous amount of computation is required to accomplish the upsampling. This also means an enormous amount of computation for decimation including low-pass filtering.
Since such an enormous amount of computation becomes necessary, an enormous amount of time for computation is required. This can become a fatal shortcoming in processing video signals or audio signals when real time processing is required.